#include<bits/stdc++.h>
using namespace std;
int n,a[100005],cnt[100005],vis=0,kil=0,ans,mx[100005],id;
int main(){
	freopen("duel.in","r",stdin);
	freopen("duel.out","w",stdout);
	//cin.tie(0);
	//cout.tie(0);
	//ios::sync_with_stdio();
	cin>>n;
	ans=n;
	if(n==1){
		cin>>a[0];
		cout<<a[0];
		return 0;
	}
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	mx[0]=a[0];
	for(int i=0;i<n;i++){
		//cout<<a[i];
		cnt[a[i]]++;
		if(a[i]!=mx[id]){
			id++;
			mx[id]=a[i];
		}
	}
	//cout<<"inewin";
	//for(int i=0;i<=id;i++)cout<<cnt[mx[i]];
	//cout<<id<<"idid";
	int k=0,q=1;
	//cout<<"done"<<endl;
	while(q!=id+1&&k!=id){
		
		if(vis==cnt[mx[q]]){
			vis=0;q++;continue;
		}
		if(cnt[mx[k]]==0){
			if(k==id-1)break;
		k++;
		if(k==q){
			q=k+1;
			vis=0;
		}	continue;
		}
		else if(cnt[mx[k]]){
			vis++;cnt[mx[k]]--;ans--;//cout<<k<<" "<<q<<endl;
		}
	}
	cout<<ans;
	return 0;
}
